<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@page import="weaver.hrm.attendance.domain.HrmLeaveTypeColor"%>
<jsp:useBean id="colorManager" class="weaver.hrm.attendance.manager.HrmLeaveTypeColorManager" scope="page" /><!-- 日期时间类 -->

<%@ include file="/hrm/header.jsp" %>
<jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" />

<%
	Calendar today = Calendar.getInstance (); //日期时间类
	String currentDate = Util.add0(today.get(Calendar.YEAR), 4) + "-"
					   + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-"
					   + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2);//获取当前日期

	String fromDate = strUtil.vString(request.getParameter("fromDate"));//开始时间
	String toDate = strUtil.vString(request.getParameter("toDate"));//结束时间
	
	String CTNo = Util.null2String(request.getParameter("CTNo"));//餐厅编号
	
	String fileName = fromDate+" "+SystemEnv.getHtmlLabelName(15322,user.getLanguage())+" "+toDate+" 的维修报表  餐厅编号="+CTNo;//标题
 
%>
<!--<table  border=0 width="100%" >
	<tbody>
		<tr>
			<td align="center" ><font size=4><b><%=fileName%></b></font></td><!-- 标题 
		</tr>
		<tr>
			<td align="right" ></td>
		</tr>
	</tbody>
</table>-->

<table  border=1  bordercolor=black style="border-collapse:collapse;" width="100%" >
	<COLGROUP>
		<COL width="9%">
		<COL width="9%">
		<COL width="6%">
		<COL width="6%">
		<COL width="6%">
		<COL width="6%">
		<COL width="6%">
		<COL width="6%">
		<COL width="6%">
		<COL width="6%">
		<COL width="6%">
		<COL width="6%">
		<COL width="6%">
		<COL width="6%">
	</COLGROUP>
	<tbody>
		<tr>
			<td align="center">序号</td>
			<td align="center">叫修编号</td>
			<td align="center">EPS单号</td>
			<td align="center">餐厅编号</td>
			<td align="center">餐厅名称</td>
			<td align="center">区域</td>
			<td align="center">报价日期</td>
			<td align="center">维修内容</td>
			<td align="center">维修金额</td>
			<td align="center">维修员</td>
			<td align="center">报价同意时间</td>
			<td align="center">维修情况</td>
			<td align="center">请款情况</td>
			<td align="center">收款情况</td>
			<td align="center">班组付款情况</td>
		</tr>
		<%
			
			String sql = "select a.sqrq,a.lcbh,a.WPSDH,a.ctbh,c.ctmc,a.quyu,a.gdrq,a.gzms,a.fyzj,b.wxbz,b.sqrq,b.wxwcsj from formtable_main_40 a,formtable_main_72 b,uf_wxdpnm c where a.requestId=b.xglc and b.ctmc=c.id";
			
			if(!fromDate.equals("") && !toDate.equals("")){
				sql += " and a.sqrq between '"+fromDate+"' and '"+toDate+"'";
			}else if(!fromDate.equals("")){
				sql += " and a.sqrq='"+fromDate+"'";
			}else if(!toDate.equals("")){
				sql += " and a.sqrq='"+toDate+"'";
			}
			
			if(!CTNo.equals("")){
				sql += " and a.ctbh  like '%"+CTNo+"%'";
			}
			rs.executeSql(sql);
			int a = 0;
			while(rs.next()){
				a = a+1;
				out.println("<tr>");
				out.print("<td align='center'>"+a+"</td>");
				out.print("<td align='center'>"+rs.getString("lcbh")+"</td>");//叫修编号
				out.print("<td align='center'>"+rs.getString("WPSDH")+"</td>");//EPS单号
				out.print("<td align='center'>"+rs.getString("ctbh")+"</td>");//餐厅编号
				out.print("<td align='center'>"+rs.getString("ctmc")+"</td>");//餐厅名称
				out.print("<td align='center'>"+rs.getString("quyu")+"</td>");//区域
				out.print("<td align='center'>"+rs.getString("gdrq")+"</td>");//报价内容
				out.print("<td align='center'>"+rs.getString("fyzj")+"</td>");//维修金额
				日期
				out.print("<td align='center'>"+rs.getString("gzms")+"</td>");//维修
				String wxy = "";
				String wxbz = strUtil.vString(rs.getString("wxbz"));
				String hrmSql = "select lastname from HrmResource where id in("+wxbz+")";
				rs1.executeSql(hrmSql);
				while(rs1.next()){
					wxy += strUtil.vString(rs1.getString("lastname"));
				}
				out.print("<td align='center'>"+wxy+"</td>");//维修员
				
				out.print("<td align='center'>"+rs.getString("sqrq")+"</td>");//报价同意时间
				out.print("<td align='center'>"+rs.getString("wxwcsj")+"</td>");//维修情况
				out.print("<td align='center'></td>");//
				out.print("<td align='center'></td>");//
				out.print("<td align='center'></td>");//
				out.print("</tr>");
			}
		%>
	</tbody>
</table>
<table border=0 width="100%">
	<tbody>
		<tr>
			<td align="right" ><%=SystemEnv.getHtmlLabelName(20087,user.getLanguage())+"："+currentDate%></td>
		</tr>
	</tbody>
</table>
